﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


namespace com.YiXiong.XML
{
    public class XmlAttributeCollection : CollectionBase
    {
        public virtual XmlAttribute this[int index]
        {
            get
            {
                return (XmlAttribute)InnerList[index];
            }
            set
            {
                InnerList[index] = value;
            }

        }

        public XmlAttributeCollection()
            : base()
        {

        }

        public virtual void Add(XmlAttribute e)
        {
            InnerList.Add(e);
        }

        public virtual void Add(XmlAttributeCollection e)
        {
            foreach (XmlAttribute entidad in e)
            {
                Add(entidad);
            }
        }

        public void Sort(IComparer comparer)
        {
            InnerList.Sort(comparer);
        }

        public virtual XmlAttribute FindById(object id)
        {
            XmlAttribute result = null;
            foreach (XmlAttribute aux in InnerList)
            {
                if (aux.Name == (string)id)
                {
                    result = aux;
                    break;
                }
            }
            return result;
        }

        #region CollectionBase virtualize method
        public virtual new int Count
        {
            get
            {
                return InnerList.Count;
            }
        }

        public virtual new void Clear()
        {
            InnerList.Clear();
        }

        public virtual new IEnumerator GetEnumerator()
        {
            return InnerList.GetEnumerator();
        }

        public virtual new void RemoveAt(int index)
        {
            InnerList.RemoveAt(index);
        }

        #endregion

    }
}
